new Vue({
	el: '#app',
	data: {
		nav_item: 1,
		product_details: '<p>123<img src="img/product_plain_banner.png" /></p>',
		video_lists: ['plug/video/mp4.mp4', 'plug/video/mp4.mp4'],
		isplay: false,
		oldplay: '' //正在播放视频索引值
	},
	mounted: function() {
		var _this = this;

		//		 load.show();

		_this.ready();
	},
	methods: {
		ready: function() {
			var _this = this;

			//          _this.ajax();
			_this.Swiper()
		},
		ajax: function() {
			var _this = this;
			$.ajax({
				url: API + 'welcome/mobile',
				type: 'get',
				success: function(res) {
					load.hide();
					if(res.returnNo == '0000') {

					}
				}
			});
		},
		Swiper: function() {
			var swiper = new Swiper('.swiper-container', {
				slidesPerView: 1,
				spaceBetween: 10,
				loop: true,
				pagination: {
					el: '.swiper-pagination',
					clickable: true,
				},
				autoplay: {
					delay: 3000,
					disableOnInteraction: false
				}
			});
		},
		nav_change: function(index) {
			this.nav_item = index
		},
		//点击视频播放(暂停其他播放视频)
		Playod: function(index) {
			var _this = this;
			var video = document.getElementsByClassName('video')[index]; //点击播放的对象
			var oldvideo = document.getElementsByClassName('video')[this.oldplay]; //正在播放的对象
			if(this.oldplay !== index && this.oldplay === '') { //首次点击的时候
				video.play();
				video.controls = true;
				this.oldplay = index;
			} else if(this.oldplay !== index && this.oldplay !== '') { //点击的视频跟播放的视频不是同一个对象的时候
				oldvideo.pause();
				video.play();
				this.oldplay = index;
				console.log(this.oldplay === index)
			} else if(this.oldplay === index && this.oldplay !== '') { //二次点击视频的时候
				oldvideo.pause();
				this.oldplay = '';
			}
						//监听播放时间
			video.ontimeupdate = function() {
				console.log('播放时间:' + this.currentTime);
			};
			//监听暂停状态
			video.onpause = function() {
				console.log('暂停时间:' + this.currentTime);
			}
			//用户已经拖动进度条
			//			video.onseeked = function() {
			//				console.log('已经拖动进度条');
			//				return false;
			//			}
			//			//用户正在拖动进度条
			//			video.onseeking = function() {
			//				console.log(拖动进度条);
			//				return false;
			//			}
			//监听视频结束
			video.onended = function() {
				console.log('结束时间:' + this.currentTime);
				_this.oldplay = '';
				return false;
			}

		},
		Playonended: function() {
			console.log(1)
		}
	}
});